from TextUI import TextUI
from Card import Card
from CardBox import CardBox
from Player import Player
import CardBoxInit


class QSZHGame:

    def __init__(self):
        self.__humenPlayer = Player('YOYO', CardBoxInit.initWofang(), Player.HUMAN)
        self.__machinePlayer = Player('大猪头', CardBoxInit.initDuifang(), Player.MACHINE)
        self.__ui = TextUI(self.__humenPlayer, self.__machinePlayer)

    def start(self):
        roundIdx = 0

        self.__ui.showTitle('七圣召唤，派蒙乱蹿！')
        self.__ui.showPlayerInfo('[牌局开始]')

        while not self.__humenPlayer.isEmptyByCardBox() and not self.__machinePlayer.isEmptyByCardBox():
            self.__ui.showRoundInfo('开始', roundIdx + 1)
            self.__humenPlayer.attach(self.__machinePlayer)
            self.__machinePlayer.attach(self.__humenPlayer)
            self.__ui.showRoundInfo('结束', roundIdx + 1)
            self.__ui.showPlayerInfo('[战斗结果]')
            print('*' * 50)
            roundIdx += 1

        self.__ui.showEndGame()